<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ include file="../components/html-tag-component.jsp"%>
<%@ include file="../components/header-loggedin-component.jsp"%>
<%@include file="../components/header-component.jsp"%>
<h2>Connect your Social Profiles</h2>
<hr />
<div class="center"><!-- Facebook -->
<h3>Facebook</h3>
<c:choose>
	<c:when test="${empty facebook}">
		<div id="fb-root"></div>
		<script src="http://connect.facebook.net/en_US/all.js"></script>
		<script>
		  FB.init({
		    appId  : '192876737424509',
		    status : true, // check login status
		    cookie : true, // enable cookies to allow the server to access the session
		    xfbml  : true  // parse XFBML
		  });
		</script>
		<fb:login-button>Login with Facebook</fb:login-button>
		<script language="javascript">
			FB.login(function(response) {
				  if (response.session) {
				  	var objData = {"access_token":response.session.access_token, "secret": response.session.secret};
				    $.post("/connect/facebook",objData,function(data){
				    	window.location.reload(true);
				    });
				  } else {
				    // user cancelled login
				  }
				});
		</script>
	</c:when>
	<c:when test="${not empty facebook}">
		<div>Connected To ${facebook.name} <img
			src="${facebook.photoUrl}"></img></div>
	</c:when>
</c:choose> <br />
<!-- Twitter -->
<hr />
<h3>Twitter</h3>
<c:choose>
	<c:when test="${empty twitter}">

		<div id="twitter_button"><a href="${twitterurl}">Connect to
		Twitter</a></div>
	</c:when>
	<c:when test="${not empty twitter}">
		<div>Connected To ${twitter.displayName} <img
			src="${twitter.photoUrl}"></img></div>
	</c:when>
</c:choose>
<hr />
<%@include file="../components/footer-component.jsp"%>